Lesson 2: The Lay of the Land

Now that we've told you about some of the things TextWrangler can do, we will take a look at the program itself and get oriented.

The TextWrangler Application

TextWrangler is distributed in the standard Mac OS X disk image format. Once you've mounted the disk image by double-clicking it, you will see the TextWrangler application itself, as you can tell by the fact that it is adorned with a full-size rendition of the classy, timeless TextWrangler icon.

Installing TextWrangler

To install TextWrangler, just drag the TextWrangler application file from the disk image to the Applications folder (or other desired location) on your hard drive.

TextWrangler's Support Folders

This section describes some folders that TextWrangler scans for tools and other useful items when you launch it. All these folders are contained in a folder named "TextWrangler", which is contained in the Application Support folder for the current user's account.

If the application support folder does not exist when TextWrangler starts up, TextWrangler will create one for you, and populate it with a set of factory default examples. Although none of these default items are essential for doing basic tasks with TextWrangler, and you can remove any or all of them, they provide additional functionality that you may wish to retain.

Language Modules

This folder contains plug-in modules that tell TextWrangler about new programming, scripting, or markup languages so that it can colorize them appropriately and generate function pop-up menu listings for them. This folder is installed empty by default, but you can find a list of language modules created third-party developers on our web site.

Plug-Ins

People at Bare Bones Software, as well as TextWrangler users everywhere, often come up with new ideas for things to do with text. Rather than releasing a new version of TextWrangler every time this happens, we gave programmers a way to create plug-in modules that work inside of TextWrangler to add new capabilities. They go in this folder.

Each plug-in adds a command to TextWrangler's Tools menu and you can run the plug-in by choosing its name from that menu. These modules are called BBEdit plug-ins, because their format was originally defined for BBEdit. TextWrangler can use any plug-ins that were created for BBEdit 7.0 and later.

Additional plug-ins and information are available from our web site, as well as the BBEdit Plug-In SDK if you are interested in writing your own plug-ins.

Shutdown Items

The items in this folder are opened when you quit TextWrangler. Usually, this function will be used to run scripts of some sort.

TextWrangler does not automatically create this folder, but you can create it if you would like to use it.

Startup Items

When launched, TextWrangler will look for a folder named Startup Items in the TextWrangler application support folder. If this folder is found, TextWrangler will open any documents it finds in that folder, either by reading them in itself (for documents TextWrangler knows how to handle), or by asking the Finder to open them.

TextWrangler does not automatically create this folder, but you can create it if you would like to use it.

Stationery

This folder contains stationery files for use with TextWrangler's Stationery List feature, which can be selected from the Window menu. When you want to create a new file, you can choose one of the files in the Stationery list as its basis.

TextWrangler does not automatically create this folder, but you can create it if you would like to use it.

Other Folders

In addition to the folders we've described above, there are several other folders which are part of the standard TextWrangler support folder: Menu Scripts, Scripts, and Unix Support. Since these folders support various advanced capabilities which TextWrangler offers, we won't be discussing them here, but you can find more information about them in Chapter 2 of the TextWrangler user manual.

TextWrangler Tutorial folder

You've probably already noticed what's in this folder, but for the record, in the TextWrangler Tutorial folder you'll find the following:

TextWrangler Tutorial.pdf

You're reading this file right now!

Tutorial Files

This folder contains example files which we will reference throughout the tutorial. The files are categorized into folders by lesson. You won't need to look at these until you get to the lesson that uses them.

If you don't have a copy of this folder, you can download a disk image containing the example files.

Starting TextWrangler

You can start TextWrangler in any of the following ways. Give one a try right now. Or try them all. (You can quit TextWrangler the same way you quit any other Macintosh application: by choosing "Quit" from the File menu, or pressing Command-Q.)

Registering

If this is the first time you've run TextWrangler, the software will ask whether you want to register, and whether to install the TextWrangler command line tool.

If you wish to register, enter your name and a valid email address in the appropriate fields, choose whether you wish to be notified of future upgrades and special offers by selecting or deselecting the Notify Me checkbox, and press the Register Now button. (You may view our privacy policy before registering by pressing the View Privacy Policy button.) If you do not wish to register, press the Skip Registration button.

For now, turn off the option to install the command line tools, as we won't be using them in this tutorial. (Unix mavens who want to play with it on their own may click Yes instead.) If you want to install these tools later, you can do so from the Tools panel of the Preferences window.

Opening Arbitrary Files

Dragging a file to the TextWrangler application icon lets you easily open text files in TextWrangler even if they weren't originally created with it. Actually, TextWrangler lets you open any type of file, even those that aren't strictly text. We can't promise you will find anything useful in non-text files, but if there's text in a file, TextWrangler will let you see and work with it. You can also drag text clippings onto TextWrangler, and the clipping contents will be placed into a new Untitled window.

Exercise

Many word processors use proprietary formats. Try dragging a Microsoft Word or WordPerfect document to TextWrangler. You'll find your text in there--along with a whole bunch of other stuff that the word processor uses to represent formatting and graphics. (If you opened a Word file that was saved with Word's Fast Save feature, the text might not be in the right order. That's because Word actually just saves your changes since the last time you saved at the end of the file when you do a Fast Save.)

Detour

It's also fun to open up PostScript files you generated with the LaserWriter driver's "Print to File" feature. PostScript is a real programming language, and every print job results in a PostScript program that is executed by your PostScript laser printer. Luckily, you don't have to learn PostScript programming to use the printer, but it's interesting to gape at if you never have before. This is one example of how you can use TextWrangler to "peel back" the polished user interface of your computer observe the text-based underbelly.

Maybe you won't want to just peek, either. There are often useful things you can do such as, for example, using TextWrangler to tweak the PostScript code produced by Quark XPress so backgrounds of placed images are transparent. When you have such tweaking to do, TextWrangler is the tool of choice.

If you open a SimpleText or Nisus Writer file in TextWrangler, you will find nothing inside but the text itself--none of the gobbledygook you find in Word files. That's because these programs save the formatting information in the file's resource fork. (Many Mac files are actually like two files in one ; they have both a data fork and a resource fork.) Many other programs store the formatting in the data fork, with the text, often because the files must be usable on computers that don't have forked files (like a PC).

Since TextWrangler only reads the data fork, where the actual text is, such files appear to be free of machine-readable formatting codes when opened in TextWrangler. However, if you edit such a file in TextWrangler and save it, the formatting may be scrambled when you open it later in the original program, because the formatting information in the resource fork won't match up properly with the text anymore.

Next on the Agenda

You've now installed TextWrangler, taken a quick tour of its application support folder, and learned how to open documents with it. What happens once you've opened a file for editing in TextWrangler? That's what we'll find out in the next lesson.